using AjeeleeCms.Core.Common;
using AjeeleeCms.Web.Plugin.Feedback.BLL;
using AjeeleeCms.Web.Plugin.Feedback.Model;
using AjeeleeCms.Web.UI;
using System;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
namespace AjeeleeCms.Web.Plugin.Feedback.admin
{
	public class reply : ManagePage
	{
		private int id = 0;
		protected AjeeleeCms.Web.Plugin.Feedback.Model.feedback model = new AjeeleeCms.Web.Plugin.Feedback.Model.feedback();
		protected HtmlForm form1;
		protected TextBox txtReContent;
		protected Button btnSubmit;
		protected void Page_Load(object sender, EventArgs e)
		{
			if (!int.TryParse(base.Request.QueryString["id"], out this.id))
			{
				base.JscriptMsg("传输参数不正确！", "back", "Error");
			}
			else
			{
				if (!new AjeeleeCms.Web.Plugin.Feedback.BLL.feedback().Exists(this.id))
				{
					base.JscriptMsg("信息不存在或已被删除！", "back", "Error");
				}
				else
				{
					if (!this.Page.IsPostBack)
					{
						this.ShowInfo(this.id);
					}
				}
			}
		}
		private void ShowInfo(int _id)
		{
			AjeeleeCms.Web.Plugin.Feedback.BLL.feedback feedback = new AjeeleeCms.Web.Plugin.Feedback.BLL.feedback();
			this.model = feedback.GetModel(_id);
			this.txtReContent.Text = Utils.ToTxt(this.model.reply_content);
		}
		protected void btnSubmit_Click(object sender, EventArgs e)
		{
			AjeeleeCms.Web.Plugin.Feedback.BLL.feedback feedback = new AjeeleeCms.Web.Plugin.Feedback.BLL.feedback();
			this.model = feedback.GetModel(this.id);
			this.model.reply_content = Utils.ToHtml(this.txtReContent.Text);
			this.model.reply_time = new DateTime?(DateTime.Now);
			feedback.Update(this.model);
			base.JscriptMsg("留言回复成功啦！", "index.aspx", "Success");
		}
	}
}
